using System;
using System.Collections.Generic;
using System.Text;

using System.Runtime.InteropServices;

namespace IEeeeInterop
{
    [ComVisible (false)]
    internal class COMCodes
    {
        public readonly static Guid CLSID_ToolbarExtButtons = new Guid ("2ce4b5d8-a28f-11d2-86c5-00c04f8eea99");

        public const int S_OK = 0;

        public const int OLECMDERR_E_UNKNOWNGROUP = -2147221244;

    }

    [Flags]
    public enum OleCmdf : int {
        Supported    = 1, 
        Enabled      = 2, 
        Latched      = 4, 
        Ninched      = 8 
    } 


    [ComVisible(true)]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352")]
    public interface IObjectWithSite
    {
        [PreserveSig]
        int SetSite([MarshalAs(UnmanagedType.IUnknown)]object site);

        [PreserveSig]
        int GetSite(ref Guid guid, out IntPtr ppvSite);
    }

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct OleCmdText
    {
        public int cmdtextf;
        public uint cwActual;
        public uint cwBuf;
        public IntPtr rgwz;
    }

    /// <summary>
    /// Struture passed as prgCmds parameter in the QueryStatus method
    /// This structure holds the command to be queried and the result of the query
    /// </summary>
    /// <purpose></purpose>
    [StructLayout(LayoutKind.Sequential)]
    public struct OleCmd
    {
        /// <summary>
        /// Command to be queried
        /// </summary>
        public uint cmdID;

        /// <summary>
        /// Result of the query
        /// </summary>
        public OleCmdf cmdf;
    }

    [ComImport ()]
    [Guid ("000214E2-0000-0000-C000-000000000046")]
    [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
    public interface IShellBrowser
    {
        void GetWindow (out IntPtr phwnd);
        void ContextSensitiveHelp (bool fEnterMode);
        void InsertMenusSB (IntPtr hmenuShared, ref IntPtr lpMenuWidths);
        void SetMenuSB (IntPtr hmenuShared, IntPtr holemenuRes, IntPtr hwndActiveObject);
        void RemoveMenusSB (IntPtr hmenuShared);
        void SetStatusTextSB (string pszStatusText);
        void EnableModelessSB (bool fEnable);
        void TranslateAcceleratorSB (IntPtr pmsg, short wID);
        void BrowseObject (IntPtr pidl, uint wFlags);
        void GetViewStateStream (long grfMode, ref System.Runtime.InteropServices.ComTypes.IStream ComTy);
        void GetControlWindow (uint id, ref IntPtr phwnd);
        void SendControlMsg (uint id, uint uMsg, short wParam, long lParam, ref long pret);
        void QueryActiveShellView (ref Object ppshv);
        void OnViewWindowActive (Object pshv);
        void SetToolbarItems (IntPtr lpButtons, uint nButtons, uint uFlags);
    }

    [ComImport]
    [GuidAttribute ("6D5140C1-7436-11CE-8034-00AA006009FA")]
    [InterfaceTypeAttribute (ComInterfaceType.InterfaceIsIUnknown)]
    public interface IServiceProvider
    {
        void QueryService (ref Guid guidService, ref Guid riid,
                  [MarshalAs (UnmanagedType.Interface)] out object ppvObject);
    }
}